package com.example.textview;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.widget.TextView;

import com.example.textview.util.ToastUtil;

public class TextViewActivity extends AppCompatActivity {

    private TextView mTV4;
    private TextView mTV5,mTV6;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text_view);
        mTV4=findViewById(R.id.tv4);
        mTV4.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);//中划线
        mTV4.getPaint().setAntiAlias(true);//去除锯齿


        mTV5=findViewById(R.id.tv5);
        mTV5.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//下划线
       // mTV5.getPaint().setAntiAlias(true);//去除锯齿


        mTV6=findViewById(R.id.tv6);
        mTV6.setText(Html.fromHtml("<u>邵靖远 很棒</u>"));

        Log.d("tag","这个运行");
        Bundle bundle =getIntent().getExtras();
        if(bundle!=null) {
            String tex = bundle.getString("name");
            if (tex != null)
                ToastUtil.showMsg(this, tex);
            //mTV4.setText(tex);
        }

        Log.d("TEST","onCreate");
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d("TEST","onStart()");

        Intent intent=new Intent();
        Bundle bundle=new Bundle();
        bundle.putString("www","我回来了");
        intent.putExtras(bundle);
        setResult(Activity.RESULT_OK,intent);
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.d("TEST","onPause()");
    }

    @Override
    protected void onStop() {
        super.onStop();
       // ToastUtil.showMsg(this,"结束！");
        Intent intent=new Intent();
        Bundle bundle=new Bundle();
        bundle.putString("www","我回来了");
        intent.putExtras(bundle);
        setResult(Activity.RESULT_OK,intent);
        Log.d("TEST","onStop()");
    }

    @Override
    protected void onDestroy() {


        super.onDestroy();
        Log.d("TEST","onDestroy()");

    }
}